package PacoteFinal;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Vitor
 */

import java.awt.Color;
import javax.swing.ImageIcon;

public class Banner extends Thread {
    
    public javax.swing.JLabel Label = new javax.swing.JLabel();
    private ImageIcon img1 = new ImageIcon("C:/Imagem1.jpg");
    private ImageIcon img2 = new ImageIcon("C:/Imagem2.jpg");
    private ImageIcon img3 = new ImageIcon("C:/Imagem3.jpg");
    private int i = 0;
    
    

   
    public Banner(java.awt.Rectangle x)
    {        
        img1.setImage(img1.getImage().getScaledInstance(x.width-40, x.height/3, 100));
        img2.setImage(img2.getImage().getScaledInstance(x.width-40, x.height/3, 100));
        img3.setImage(img3.getImage().getScaledInstance(x.width-40, x.height/3, 100));
        Label.setBounds(20, 20, x.width-40, x.height/3);
        Label.setBackground(Color.black);
        Label.setIcon(img1);        
    }
    
    public void change_img()
    {
        if(i % 3 == 0)
            Label.setIcon(img1);
        else if(i % 3 == 1)
            Label.setIcon(img2);
        else if(i % 3 == 2)
            Label.setIcon(img3);
        
        ++i;
    }
    
    public void run()
    {
        change_img();
    }
}
